package com.czx.common.exception;


import com.czx.common.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Slf4j
public class BlogExceptionHanlder {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public R systemException(Exception e) {
        e.printStackTrace();
        return R.fail("系统正在维护，请联系管理员");
    }

    @ExceptionHandler(BlogException.class)
    @ResponseBody
    public R BlogException(BlogException e){
        return R.fail(e.getMsg());
    }

}
